<!DOCTYPE html>
<html lang="en">

<head>
    <meta charset="UTF-8">
    <meta http-equiv="X-UA-Compatible" content="IE=edge">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>Document</title>
    <style>
        * {
            padding: 0;
            margin: 0;
        }

        h4 {
            text-align: center;
        }

        .tabsbox {
            width: 800px;
            height: 400px;
            border: 2px solid #ccc;
            margin: auto auto;
        }

        .firstnav {
            width: 100%;
            height: 60px;
            border-bottom: 1px solid #ccc;
        }

        li {
            list-style: none;
            float: left;
            cursor: pointer;
        }

        .firstnav li {
            width: 100px;
            height: 60px;
            text-align: center;
            border-right: 3px solid #ccc;
            margin-right: 0;
            line-height: 60px;
            position: relative;
        }

        .tabadd {
            float: right;
            cursor: pointer;

        }

        .tabadd span {
            display: inline-block;
            width: 40px;
            height: 40px;
            border: 1px solid #ccc;
            line-height: 40px;
            text-align: center;
        }

        .tabscon .conactive {
            display: block;
        }

        .tabscon section {
            display: none;
        }

        .iconfont {
            display: inline-block;
            position: absolute;
            width: 20px;
            height: 20px;
            background-color: skyblue;
        }
    </style>
</head>

<body>
    <main>
        <h4>js 面向对象 动态添加便签页</h4>
        <div class="tabsbox" id="tab">
            <nav class="firstnav">
                <ul>
                    <li class="liactive"><span>测试1</span><span class="iconfont icon-guanbi"></span></li>
                    <li><span>测试2</span><span class="iconfont icon-guanbi"></span></li>
                    <li><span>测试3</span><span class="iconfont icon-guanbi"></span></li>
                </ul>
                <div class="tabadd">
                    <span>+</span>
                </div>
            </nav>

            <div class="tabscon">
                <section class="conactive">测试1</section>
                <section>测试2</section>
                <section>测试3</section>
            </div>
        </div>
    </main>
    <script src="tab.js"></script>
</body>

</html>